package cn.xi.dao;

import cn.xi.pojo.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;
import java.util.Map;


public interface MemberDao {
    @Select("select id from t_member where idCard = #{idCard}")
    Integer selectidCard(String idCard);

    @Select("select * from t_member where phoneNumber = #{telephone}")
    Member selectPhoneNumber(String telephone);

    @Insert("insert into t_member (name,sex,phoneNumber,idCard) values (#{name},#{sex},#{phoneNumber},#{idCard})")
    void save(Member member);

    @Select("select LAST_INSERT_ID()")
    Integer getid();

    @Insert("insert into t_member (phoneNumber,regTime) value (#{phoneNumber},#{regTime})")
    void savephone(Member member);


    @Select("select  COUNT(*) from t_member where regTime <=#{s}")
    Integer selectTimeNumber(String s);

    @Select("select  COUNT(*) number ,regTime from t_member where regTime <=#{time} and regTime >=#{time1} group by DATE_FORMAT(regTime,'%Y.%m')")
    List<Map> selectTimeNumber2(@Param("time") String time, @Param("time1") String time1);
}
